import {request, writeLog} from "@/libs/core.js"
import { Message } from 'element-ui'
/**
入驻明星校验逻辑
****************************************************************/
const getList = async(args) => {
  const data = await request({url:'/ucenter/star/dolist', data:args, method:'post'});
  if (data && data.code == 0 ) {
    return data;
  }
  return false;
}

const doUser = async(args) => {
	const data = await request({url:'/ucenter/star/douser', data:args, method:'post'});
	if(data && data.code == 0){
		Message({message: '明星管理员设置成功', type: 'success', duration: 3 * 1000});
		return true;
	}
  return false;
}

const doWallet = async(args) => {
	const data = await request({url:'/ucenter/star/wallet', data:args, method:'post'});
	if(data && data.code == 0){
		Message({message: '明星钱包设置成功', type: 'success', duration: 3 * 1000});
		return true;
	}
  return false;
}

const doSave = async(args) => {
	const data = await request({url:'/ucenter/star/dosave', data:args, method:'post'});
	if(data && data.code == 0){
		if(!args.id){
			Message({message: '明星入驻新增成功', type: 'success', duration: 3 * 1000});
		}else{
			Message({message: '明星入驻编辑成功', type: 'success', duration: 3 * 1000});
		}
		return true;
	}
  return false;
}

export default {
	getList,doUser,doWallet,doSave
};